<div class="edit_file" >
  <%= start_form_tag({:action => :on_edit_file}, {:onsubmit => "return checkCategory()", :multipart => true}) %>
    <p><%= hidden_field "resource", "id" %></p>
    <p><%= hidden_field "resource", "ecase_id", :value => @ecase_id %></p>
    <div class="file" >
      <% if @resource.nil? -%>
        <p>Choose a file to upload<br />(each file should be under <%= format_bytes(MAX_RESOURCE_SIZE) %>)</p>
      <% else -%>
        <p>You are editing file:<br /> <%= @resource.name %></p>
      <% end -%>
      <p><%= file_column_field "resource", "url" %></p>
    </div>
    <div class="description" >
      <p>Optional description</p>
      <p><%= text_field "resource", "description", {:size => 50} %></p>
    </div>
    <div class="category" >
      <p>Category</p>
      <p><%= select "category", "id", @resource_categories, :selected => @selected %></p>
      <p><%= hidden_field "category", "old_id", :value => @selected %></p>
    </div>
    <div class="submit" >
      <p>
        <%= submit_tag "Upload file" %>
        <%= link_to_function "Cancel", "onCancelEditResource()", :class => "red" %>
      </p>
    </div>
  <%= end_form_tag %>
</div>